//--- Hello, World! for CppUnit

#include <iostream>

#include <cppunit/TestRunner.h>
#include <cppunit/TestResult.h>
#include <cppunit/TestResultCollector.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/BriefTestProgressListener.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/CompilerOutputter.h>

#include <string>
#include "DiskAbstraction.h"
#include "FileSystem.h"
#include "LowLevelLayer.h"
#include "SystemCalls.h"
using std::string;
using std::cout;
using std::endl;

//CPPUNIT_TEST_SUITE_REGISTRATION(DiskAbstractionTestCase);
//CPPUNIT_TEST_SUITE_REGISTRATION(SuperBlockDataTestCase);

//CPPUNIT_TEST_SUITE_REGISTRATION(LowLevelLayerTestCase);
CPPUNIT_TEST_SUITE_REGISTRATION(FileSystemTestCase);
//CPPUNIT_TEST_SUITE_REGISTRATION(SystemCallsTestCase);
int main( int ac, char **av ) {
    //--- Create the event manager and test controller
    CPPUNIT_NS::TestResult controller;

    //--- Add a listener that colllects test result
    CPPUNIT_NS::TestResultCollector result;
    controller.addListener( &result );

    //--- Add a listener that print dots as test run.
    CPPUNIT_NS::BriefTestProgressListener progress;
    controller.addListener( &progress );

    //--- Add the top suite to the test runner
    CPPUNIT_NS::TestRunner runner;
    runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );

    runner.run( controller );

	std::cerr << std::endl;

	// Print test in a compiler compatible format.
	CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr );
	outputter.write();

    return result.wasSuccessful() ? 0 : 1;
}
